# Which compiler
# CC = gcc
# AR = ar
# AT = @


OUTPUT = beep


# source file
SRCS = ${wildcard *.c}

OBJS = $(patsubst %.c,%.o,$(SRCS))

# LIBS = -luart
# LIBS += -lpthread

# Where are include files kept
INCLUDES = -I$(PROJ_ROOT_PATH)

# Option for development
CFLAGS += -g -O2 -Wall
# Option for release
# CFLAGS = -O -Wall


include $(PROJ_ROOT_PATH)/board.mk


$(OUTPUT): $(OBJS)
	$(AT)$(CC) $^ -o $(BIN_PATH)$@ $(INCLUDES) $(LIBS) -L$(LIBS_PATH)
	$(AT)echo "$(OUTPUT) linking done"

$(OBJS): $(SRCS)
	$(AT)echo "CFLAGS: $(CFLAGS)"
	$(AT)$(CC) -c $< $(CFLAGS) $(INCLUDES) -o $@
	$(AT)echo "$(OBJS) compiling done"


.PHONY: clean
clean:
	$(AT)-rm -rf $(OBJS)

